const crypto = require('crypto');

class HtmlInfo {
    constructor(is_frame, title, url, html_path, system_name, url_md5,parentUrlMd5) {
        this.is_frame = is_frame;
        this.title = title;
        this.url = url;
        this.html_path = html_path; // corrected variable name
        this.system_name = system_name;
        this.url_md5 = url_md5;
        this.parent_url_md5 = parentUrlMd5;
    }

    getInsertSql() {
        return `INSERT INTO html_info(id, title, url, html_path, is_frame, system_name, url_md5,parent_url_md5) VALUES ($1, $2, $3, $4, $5, $6, $7,$8)`;
    }

    getInsertValues() {
        let id = crypto.randomUUID(); // generate a new UUID for id
        let values = [id, this.title, this.url, this.html_path, this.is_frame, this.system_name, this.url_md5,this.parent_url_md5];
        return values;
    }
}

module.exports = HtmlInfo;
